home *** CD-ROM | disk | FTP | other *** search
- { Qfills.inc - QfillC, Qfill, Qattr, QattrC ver 3.0, 08-31-87 }
- { After Qinit is executed, this procedure does fast screen writes and works
- on any IBM adapter. It also has the feature of leaving the attribute alone
- by setting Attr<0; then Qfill will just overwrite the display using the
- current attributes (Qattr will simply abort the procedure). The upper left
- column is 1,1. Cols and Rows can range from 1 to screen limits. Example
- applications for Qfill is a fast screen clear or clear EOL; for Qattr is
- changing the highlighted cursor in pull down menus without the need of a
- string. Please limit Cols to the number in one row (<200).
- Read MODIFICATIONS in QWIK30.DOC for possible changes in this file. }
-
- { QfillsDisp - Subroutine for all Qfills procedures ver 3.0, 08-31-87 }
- procedure QfillsDisp;
- begin
- Inline( {Assembly by Inline 08/17/87 00:31}
- $48/ { dec ax ;Convert to 0-?? range}
- $31/$D2/ { xor dx,dx ;Set DX=0}
- $8E/$C2/ { mov es,dx ;Set ES=0}
- $26/ { es: ;Segment override}
- $8B/$16/$4A/$04/ { mov dx,[$044A] ;Get CRT columns}
- $F6/$E2/ { mul dl ;(CRT columns)*(Row-1)}
- $D1/$E0/ { shl ax,1 ;Mult by 2}
- $01/$C7/ { add di,ax ;Dest offset in DI}
- $88/$E8/ { mov al,ch ;Move attr to AH}
- $30/$ED/ { xor ch,ch ;Set CH=0}
- $29/$CA/ { sub dx,cx ;Subract Cols}
- $D1/$E2/ { shl dx,1 ;Mult by 2}
- $52/ { push dx ;Save # to next row}
- $51/ { push cx ;Save # of Cols}
- { ;}
- $85/$F6/ { test si,si ;If Rows<=0 ...}
- $7E/$31/ { jle DoneS ; nothing to do}
- $85/$C9/ { test cx,cx ;If Cols<=0 ...}
- $7E/$2D/ { jle DoneS ; nothing to do}
- { ;}
- $88/$DC/ { mov ah,bl ;Move attr to AH}
- $FC/ { cld ;Set DF to increment}
- $3A/$2E/>QWAIT/ { cmp ch,[>Qwait] ;Check need for wait}
- $8E/$06/>QSEG/ { mov es,[>Qseg] ;ES:DI dest pointer}
- $75/$29/ { jne Color ; use Color routine}
- $84/$FF/ { test bh,bh ;If Attr<0 ...}
- $78/$0E/ { js Mono1 ; use char only}
- { ;}
- {; -- Mono routine; Attr, Char and No Wait--}
- $89/$CA/ { mov dx,cx ;Save Cols in DX}
- $F2/$AB/ {Mono2: rep stosw ;To dest & inc DI 2}
- $4E/ { dec si ;Decrement rows left}
- $74/$15/ { jz DoneS ;If Rows=0, done}
- $89/$D1/ { mov cx,dx ;Restore Cols}
- $03/$7E/$FA/ { add di,[bp-$06] ;Dest for next row}
- $EB/$F4/ { jmp SHORT Mono2 ;Next row}
- { ;}
- {; -- Mono routine; Char/Attr Only and No Wait--}
- {; Algorithm packs in an extra STOSB per LOOP}
- $41/ {Mono1: inc cx ;Bump CX for odd col}
- $89/$CA/ { mov dx,cx ;Save Cols in DX}
- $D1/$E9/ {Mon1a: shr cx,1 ;Divide counter by 2}
- { ; CF=0 if odd count}
- $73/$02/ { jnc Mon1c ;Jump if odd count}
- { ;}
- $AA/ {Mon1b: stosb ;To dest & inc DI 1}
- $47/ { inc di ;Pass up attr/char}
- $AA/ {Mon1c: stosb ;To dest & inc DI 1}
- $47/ { inc di ;Pass up attr/char}
- $E2/$FA/ { loop Mon1b ;Loop until CX=0}
- $4E/ { dec si ;Decrement rows left}
- $7E/$58/ {DoneS: jle Done ;If Rows=0, done}
- $89/$D1/ { mov cx,dx ;Restore Cols}
- $03/$7E/$FA/ { add di,[bp-$06] ;Dest for next row}
- $EB/$EC/ { jmp SHORT Mon1a ;Next row}
- { ;}
- $BA/$DA/$03/ {Color: mov dx,$03DA ;CGA port}
- $88/$C3/ { mov bl,al ;Save char in BL}
- $84/$FF/ { test bh,bh ;If Attr<0 ...}
- $78/$27/ { js Col1a ; use char/attr only}
- { ;}
- {; -- Color routine; Attr, Char and Wait --}
- $FA/ {Col2a: cli ;Disable interrupts}
- $EC/ {E4in2: in al,dx ;Check CGA status}
- $A8/$08/ { test al,$08 ;If #3 bit clear ...}
- $74/$07/ { jz Col2b ; check #0 bit.}
- $88/$D8/ { mov al,bl ;Move char back in AL}
- $F2/$AB/ { rep stosw ;Quick storage}
- $FB/ { sti ;Enable interrupts}
- $EB/$0F/ { jmp SHORT Col2c ; finished row}
- $D0/$D8/ {Col2b: rcr al,1 ;If #0 bit set ...}
- $72/$F0/ { jc E4in2 ; try again for $E4}
- $EC/ {E5in2: in al,dx ;Check CGA status}
- $D0/$D8/ { rcr al,1 ;If #0 bit clear ...}
- $73/$FB/ { jnc E5in2 ; try again for $E5}
- $88/$D8/ { mov al,bl ;Move char back in AL}
- $AB/ { stosw ;Put in dest & inc DI}
- $FB/ { sti ;Enable interrupts}
- $E2/$E4/ { loop Col2a ;Loop till CX=0}
- $4E/ {Col2c: dec si ;Decrement rows left}
- $74/$29/ { jz Done ;If Rows=0, done}
- $8B/$4E/$F8/ { mov cx,[bp-$08] ;Restore Cols}
- $03/$7E/$FA/ { add di,[bp-$06] ;Dest for next row}
- $EB/$D9/ { jmp SHORT Col2a ;Next row}
- { ;}
- {; -- Color routine; Char/Attr only and Wait --}
- $FA/ {Col1a: cli ;Disable interrupts}
- $EC/ {E4in1: in al,dx ;Check CGA status}
- $A8/$08/ { test al,$08 ;If #3 bit set ...}
- $75/$09/ { jnz Col1b ; skip wait.}
- $D0/$D8/ { rcr al,1 ;If #0 bit set ...}
- $72/$F7/ { jc E4in1 ; try again for $E4}
- $EC/ {E5in1: in al,dx ;Check CGA status}
- $D0/$D8/ { rcr al,1 ;If #0 bit clear ...}
- $73/$FB/ { jnc E5in1 ; try again for $E5}
- $88/$D8/ {Col1b: mov al,bl ;Move char/attr in AL}
- $AA/ { stosb ;Put in dest & inc DI}
- $FB/ { sti ;Enable interrupts}
- $47/ { inc di ;Pass up attr/char}
- $E2/$EA/ { loop Col1a ;Loop till CX=0}
- $4E/ { dec si ;Decrement rows left}
- $74/$08/ { jz Done ;If Rows=0, done}
- $8B/$4E/$F8/ { mov cx,[bp-$08] ;Restore Cols}
- $03/$7E/$FA/ { add di,[bp-$06] ;Dest for next row}
- $EB/$DF/ { jmp SHORT Col1a ;Next row}
- { ;}
- $81/$C4/$04/$00/ {Done: add sp,$0004 ;Restore stack ptr}
- $C3); { ret ;Return to call}
- end;
-
- { QfillC - Quick screen repetitive fill, self-centering ver 3.0, 08-31-87 }
- procedure QfillC (Row, ColL, ColR, Rows, Cols: byte; Attr: integer; Ch: char);
- begin
- Inline( {Assembly by Inline 08/17/87 00:31}
- $8B/$46/<ROW/ { mov ax,[bp+<Row] ;Move row}
- $8B/$7E/<COLL/ { mov di,[bp+<ColL] ;Move left col}
- $03/$7E/<COLR/ { add di,[bp+<ColR] ;Add right col}
- $4F/ { dec di ;Convert to 0-?? range}
- $8B/$76/<ROWS/ { mov si,[bp+<Rows] ;Move number of rows}
- $8B/$4E/<COLS/ { mov cx,[bp+<Cols] ;Move number of cols}
- $29/$CF/ { sub di,cx ;Offset calc'd in DI}
- $81/$E7/$FE/$FF/ { and di,$FFFE ;Make even}
- $8B/$5E/<ATTR/ { mov bx,[bp+<Attr] ;Move attr to BX}
- $8A/$6E/<CH/ { mov ch,[bp+<Ch] ;Move char to CH}
- $E8/>QFILLSDISP-*+5); { call >QfillsDisp-*+5 ;Call QfillsDisp}
- end;
-
- { Qfill - Quick screen repetitive fill ver 3.0, 08-31-87 }
- procedure Qfill (Row, Col, Rows, Cols: byte; Attr: integer; Ch: char);
- begin
- Inline( {Assembly by Inline 08/17/87 00:31}
- $8B/$46/<ROW/ { mov ax,[bp+<Row] ;Move row}
- $8B/$7E/<COL/ { mov di,[bp+<Col] ;Move col}
- $4F/ { dec di ;Convert to 0-?? range}
- $D1/$E7/ { shl di,1 ;Mult by 2}
- $8B/$76/<ROWS/ { mov si,[bp+<Rows] ;Move number of rows}
- $8A/$4E/<COLS/ { mov cl,[bp+<Cols] ;Move number of cols}
- $8B/$5E/<ATTR/ { mov bx,[bp+<Attr] ;Move attr to BX}
- $8A/$6E/<CH/ { mov ch,[bp+<Ch] ;Move char to CH}
- $E8/>QFILLSDISP-*+5); { call >QfillsDisp-*+5 ;Call QfillsDisp}
- end;
-
- { Qattr - Quick screen attribute change ver 3.0, 08-31-87 }
- procedure Qattr (Row, Col, Rows, Cols: byte; Attr: integer);
- begin
- Inline( {Assembly by Inline 08/17/87 00:31}
- $8B/$46/<ROW/ { mov ax,[bp+<Row] ;Move row}
- $8B/$7E/<COL/ { mov di,[bp+<Col] ;Move col}
- $4F/ { dec di ;Convert to 0-?? range}
- $D1/$E7/ { shl di,1 ;Mult by 2}
- $47/ { inc di ;Pass up char}
- $8B/$76/<ROWS/ { mov si,[bp+<Rows] ;Move number of rows}
- $8A/$4E/<COLS/ { mov cl,[bp+<Cols] ;Move number of cols}
- $8B/$5E/<ATTR/ { mov bx,[bp+<Attr] ;Move attr to BX}
- $84/$FF/ { test bh,bh ;If Attr<0 ...}
- $78/$07/ { js exit ; nothing to do.}
- $88/$DD/ { mov ch,bl ;Move attr in CH}
- $B7/$80/ { mov bh,$80 ;Make BH negative}
- $E8/>QFILLSDISP-*+5 { call >QfillsDisp-*+5 ;Call QfillsDisp}
- ); {Exit:}
- end;
-
- { QattrC - Quick screen attribute change, self-centering ver 3.0, 08-31-87 }
- procedure QattrC (Row, ColL, ColR, Rows, Cols: byte; Attr: integer);
- begin
- Inline( {Assembly by Inline 08/17/87 00:31}
- $8B/$46/<ROW/ { mov ax,[bp+<Row] ;Move row}
- $8B/$7E/<COLL/ { mov di,[bp+<ColL] ;Move left col}
- $03/$7E/<COLR/ { add di,[bp+<ColR] ;Add right col}
- $4F/ { dec di ;Convert to 0-?? range}
- $8B/$76/<ROWS/ { mov si,[bp+<Rows] ;Move number of rows}
- $8B/$4E/<COLS/ { mov cx,[bp+<Cols] ;Move number of cols}
- $29/$CF/ { sub di,cx ;Offset calc'd in DI}
- $81/$CF/$01/$00/ { or di,$0001 ;Make odd;pass up char}
- $8B/$5E/<ATTR/ { mov bx,[bp+<Attr] ;Move attr to BX}
- $84/$FF/ { test bh,bh ;If Attr<0 ...}
- $78/$07/ { js Exit ; nothing to do.}
- $88/$DD/ { mov ch,bl ;Move attr in CH}
- $B7/$80/ { mov bh,$80 ;Make BH negative}
- $E8/>QFILLSDISP-*+5 { call >QfillsDisp-*+5 ;Call QfillsDisp}
- ); {Exit:}
- end;
-